/**
 * 广告计划管理相关api
 */
angular.module('imsApp').factory('AdvManagementManager', ['$http','api', 'paramsManager', function ($http,api, paramsManager) {
    var AdvManagementManager = {
        /**
         * 获取广告计划列表
         params:[pageNo,pageSize]//顺序不能错
         query :{keyword:xxx}
         */
        campaignsList: function (params, query) {
            return $http.get(api+'/ims/advertisers/campaigns/' + paramsManager.params(params) + paramsManager.query(query)).then(function (result) {
            return result;
            });
        },
        /**
         * 添加campaigns到
         */
        campaignsAdd: function (params) {
            return $http.post(api+"/ims/advertisers/campaigns", params).then(function (result) {
                return result;
            });
        },
        /**
         * 编辑campaigns到
         */
        campaignsEdit: function (campaignId,params) {
            return $http.put(api+"/ims/advertisers/campaigns/"+campaignId, params).then(function (result) {
                return result;
            });
        },
        /**
         *基础广告计划删除
         * @param creativeId
         */
        campaignsDelete: function (ids) {
            return $http.delete(api+'/ims/advertisers/campaigns/'+ids.join(",")).then(function (result) {
                return result;
            });
        }
    };


    return AdvManagementManager;
}]);
